<?php $this->load->view('header'); ?>
<div id="search-project">
	<?php echo $this->load->view('sideBlocks/searchBlock') ?>
</div>
<div class="wrap-content-app wrap-project wrap-detail-project">
<div class="container">
<div class=""> <!--row-->
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12  profile-user">
	<div class="border col-md-1"></div>
	<div class="container">
		<div class="row title-project">
			<h1><?php echo $project->project_name; ?></h1>
		</div>
	</div>
	<div class="row">
        <?php
            if($creatorInfo){
        ?>
		<div class="right-detail-project col-lg-4 col-md-4 col-sm-4 col-xs-12">
	        <div class="col-lg-12 col-sm-12 col-md-12 info-user">
	            <div>
	                <a href="#"><img style="width: 100%;" src="<?php if ($creatorInfo->logo != '') echo uimage_url($creatorInfo->logo); else echo image_default(); ?>" class="img-responsive"></a>
	            </div>
	            
	        </div>
	        <div class="col-lg-12 col-md-12 col-sm-12 info-user-footer">
	            <div class="user-row"><span><?php echo $creatorInfo->user_name;?></span><span class="col-right">HCMC, CT</span></div>
	            <div class="user-row"><span><?php echo $this->lang->line('complaints')?></span><span class="col-right complaints">0/5</span></div>
	           	<div class="user-row">
	           		<span><input id="preview-user" value="<?php echo $creatorInfo->user_rating?>" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" ></span>
	           		<span class="col-right"><?php echo $creatorInfo->num_reviews?> reviews</span>
           		</div>
           		<div class="user-row"><span><?php echo $this->lang->line('spend')?></span><span class="col-right price">$5324</span></div>
           		<div class="user-row"><span class="col-right"><a href="#"><?php echo $this->lang->line('Project report violations')?></a></span></div>
	        </div> <!-- reviews -->
	        <div class="col-lg-12 col-sm-12 col-md-12">
	            
	        </div>
	    </div> <!-- right-detail-project -->
        <?php } ?>
	    <div class="left-detail-project col-lg-8 col-md-8 col-sm-8">
	        <div class="col-lg-12 col-md-12 col-xs-12 col-sm-12 reviews project-bid">
	            <div class="col-lg-3 col-sm-3 col-md-3 col-xs-12">
	                <p class="x8-16"><?php echo $this->lang->line('Num bid')?></p>
	                <span class="x8-19-b num-bid"><?php echo getNumBid($project->id);?></span>
	            </div>
	            <div class="col-lg-3 col-sm-3 col-md-3 col-xs-12">
	                <p class="x8-16"><?php echo $this->lang->line('Avg Bid')?></p>
	                <span class="x8-19-b"><?php  echo getBidsInfo($project->id)?></span>
	            </div>
	            <div class="col-lg-3 col-sm-3 col-md-3 col-xs-12">
	                <p class="x8-16"><?php echo $this->lang->line('Budget'); ?></p>
	                <span class="x8-19-b" style="font-size: 16px;"><?php if ($project->budget_min != '0') echo '$ ' . $project->budget_min; else echo 'N/A'; ?> - <?php if ($project->budget_max != '0') echo '$ ' . $project->budget_max; else echo 'N/A'; ?></span>
	            </div>
	            <div class="col-lg-3 col-sm-3 col-md-3 col-xs-12">
	                <p class="x8-16"><?php echo $this->lang->line('Bidding Ends')?></p>
	                <span class="x8-19-b">
                        <?php
                            if(date("d/m/y") == date("d/m/y",$project->created))
                                echo "Hôm nay";
                            else
                                echo date("d/m/y", $project->created);
                        ?>
                    </span>
	            </div>
	        </div>
	        <div class="desc-detail-project col-lg-12 col-sm-12 col-md-12 col-xs-12">
	            <div class="col-lg-12 col-sm-12 col-md-12 x8-16-b des-project-title"><?php echo $this->lang->line('Description'); ?>:</div>
	            <div class="col-lg-12 col-sm-12 col-md-12 des-project-content">
	                <?php echo nl2br($project->description); ?>
	            </div>
	        </div> <!-- desc-detail-project -->
	        <div class="skill-detail-project col-lg-12 col-sm-12 col-md-12 col-xs-12 margin-top-bottom">
	            <div class="col-lg-12 col-sm-12 col-md-12 x8-16-b des-project-title"><?php echo $this->lang->line('Skills')?>:</div>
	            <div class="col-lg-12 col-sm-12 col-md-12 xanh-15 des-project-content">
	                <?php echo getCategoryLinks($project->project_categories); ?>
	            </div>
	        </div>
	        <div class="col-lg-12 col-sm-12 col-md-12 col-xs-12 no-padding">
		        <div class="col-lg-5 col-xs-12 col-md-5 col-sm-12 no-padding similar-project">
				    <a onclick="window.location = '<?php echo site_url('project/create/'.$project->id)?>'" href="#<?php //echo site_url('project/postProject/'.$project->id)?>" class="btn btn-default btn-similar-project btn-lg btn-block"><i class="icon_similar_project"></i><?php echo $this->lang->line('Post Similar Project'); ?></a>
				</div>
	        </div>
	    </div> <!-- left-detail-project -->
    </div>
</div> <!-- profile-user -->
</div>
</div>
</div>

<?php
    if($project->project_status < 2){
?>
<div class="wrap-content wrap-postbid">
	<div class="container">
		<div class="row">
			<div>

                <div class="col-lg-12 col-xs-12 bid no-padding col-sm-12 col-md-12">
                    <?php
                    if($project->project_status == 0){
	                    if(isset($bid)){
	                        $bid = $bid->row();
	                    }
	                    if (!empty($bid))
	                        $this->load->view('project/editBid');
	                    else
	                        $this->load->view('project/postBid');
                    }else{
                    ?>

                    <?php
                        if(isset($this->loggedInUser->id) == TRUE){
                            if(($project->programmer_id == $this->loggedInUser->id) || ($project->creator_id == $this->loggedInUser->id)){
                                if(isset($rows_projects_milestones) == TRUE && $rows_projects_milestones->num_rows() >= 1){
                                    $this->load->view('project/editMilestone');
                                }else{
                                        $this->load->view('project/createMilestone');
                                }
                            }
                        }
                    }
                    ?>
                </div> <!-- bid -->

			</div>
		</div>
	</div>
</div>
<div class="wrap-content wrap-public-message">
	<div class="public-message">
        <div class="container">
        <?php echo $this->lang->line('Public message board');?>
        </div>
    </div>
</div>

<div class="wrap-content wrap-list-bid">
	<div class="container">
		<div class="row">

			<div class="col-lg-12 col-sm-12 col-md-12 col-xs-12 no-padding" id="list-freelancer-bid">
			    <?php $this->load->view('project/listFreelancerBid');?>
			</div> <!--list-freelancer-bid-->

		</div> <!-- end row content -->
	</div>
</div> <!-- wrap-content -->

<div class="recommend-dev">
	<div class="public-message">
        <div class="container">
        <?php echo $this->lang->line('Recommend Developer');?>
        </div>
    </div>
</div>
<div class="wrap-list-recommend">
	<div class="container">
		<?php $this->load->view('project/listFreelancerRecommend');?>
	</div>
</div> <!-- wrap-content -->
<?php } elseif($project->project_status == 3){
		echo "<div class='wrap-content'><div class='container'>Dự án đã hủy</div></div>";
}else{
        echo "<div class='wrap-content'><div class='container'>Dự án đã hoàn thành</div></div>";
    }
?>
<style>


	@media only screen and (max-width: 767px) {
		/* Force table to not be like tables anymore */

		#list-freelancer-bid{
			margin-top:-10px;
		}
		.list-freelancer-bid > table, .list-freelancer-bid > table > thread,.list-freelancer-bid > table > tbody,.dashboard th,.list-freelancer-bid > table  td,.list-freelancer-bid > table tr {
			display: block;
		}
		.list-freelancer-bid > table > tbody > tr:first-child{
			display: none;
		}

		.list-freelancer-bid > table > tbody tr { padding: 5px;}

		.list-freelancer-bid > table > tbody td {
			border: none;
			position: relative;
			padding: 5px;
		}
		.list-freelancer-bid > table > tbody tr td{
			padding-left: 45%;
			overflow: hidden;
			white-space: normal !important;
			font-size: 14px;
		}
		.list-freelancer-bid > table > tbody td:before {
			position: absolute;
			top: -2px;
			left: 6px;
			width: 45%;
			padding-right: 10px;
			white-space: nowrap;
		}
		/*
		Label the data
		*/
		.list-freelancer-bid > table > tbody td:nth-of-type(1){
			padding:0;
		}
        .list-freelancer-bid > table > tbody td:nth-of-type(2):before { content: "<?php echo $this->lang->line("Bid Price")?>"; }
        .list-freelancer-bid > table > tbody td:nth-of-type(3):before { content: "<?php echo $this->lang->line("Delivery Time")?>"; }
		.list-freelancer-bid > table > tbody td:nth-of-type(4):before { content: ""; }
}

</style>
<!--END OF POST PROJECT-->
<?php $this->load->view('footer'); ?>
